home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir24 / aprs503a.zip / MAKEBIG.BAS < prev    next >
BASIC Source File  |  1994-05-11  |  4KB  |  130 lines

  1. REM This program is a modification of MAPCNVRT.BAS to take several smaller
  2. REM maps and extract only the Interstates and major four lane roads and place
  3. REM them in a larger area map.
  4.  
  5. REM To save redundant typing of the source information, use an editor to
  6. REM prepare a source file in the following format:
  7.  
  8. REM *This file tells MAKEBIG.BAS how to combine the following maps into one
  9. REM *large area map.  Any number of comment lines are permitted...
  10. REM *BEGIN*
  11. REM 40.5, Latitude of resultant large map Origin
  12. REM 98.5, Longitude of resultant Origin
  13. REM 300, Desired final Pixels-Per-Degree
  14. REM \APRS500\MAPS, This is the path for QBasic to use to find the following maps
  15. REM OH-MI-WV
  16. REM OHIO
  17. REM INapolis
  18. REM PAPtsbrg
  19. REM *END*
  20.  
  21. OPTION BASE 0
  22. REM $DYNAMIC
  23. DIM Labels$(150)
  24.  
  25. CLS
  26. PRINT "This program will convert all the maps listed in a MakeBig.dat file"
  27. PRINT "into a single larger map by extracting only the Interstates and major"
  28. PRINT "state or national highways (green and bright red roads)."
  29. PRINT
  30. PRINT "The output of this program will be in MAPTEMP.map"
  31. PRINT
  32. Start: INPUT "Enter File name of source map if other than MakeBig.dat"; F$
  33.        IF F$ = "" THEN F$ = "MakeBig.dat"
  34.        IF INSTR(F$, ".") = 0 THEN F$ = F$ + ".dat"
  35.        OPEN F$ FOR INPUT AS #1
  36.  
  37.        INPUT "Enter file name for output if other than MAPTEMP.MAP"; FO$
  38.        IF FO$ = "" THEN FO$ = "MAPTEMP.MAP"
  39.        OPEN FO$ FOR OUTPUT AS #4
  40.  
  41.  
  42.         DO UNTIL A$ = "*BEGIN*": LINE INPUT #1, A$: LOOP
  43.  
  44.         INPUT #1, NLat: LINE INPUT #1, A$
  45.         INPUT #1, NLon: LINE INPUT #1, A$
  46.         INPUT #1, PPDD: LINE INPUT #1, A$
  47.                   LATcen = NLat - (500 / PPDD)
  48.                   LONcen = NLon - (500 / PPDD)
  49.                   MapRng = 60 * 500 / PPDD
  50.         INPUT #1, PATH$: LINE INPUT #1, A$
  51.  
  52. REM PREPARE OUTPUT FILE STUFF
  53.  
  54.      PRINT #4, NLat; ", Latitude of Origin"
  55.      PRINT #4, NLon; ", Longitude of Origin"
  56.      PRINT #4, PPDD; ", Pixels-Per-Degree"
  57.      PRINT #4, LATcen; ", Lat of map center"
  58.      PRINT #4, LONcen; ", Lon of map center"
  59.      PRINT #4, MapRng; ", map range"
  60.      PRINT #4, "0 , Field not used"
  61.      PRINT #4, "This is a comment line: THIS MAP GENERATED BY MAKEBIG.bas"
  62.     
  63.      ON ERROR GOTO Errorfix
  64.  
  65. REM NOW BEGIN PROCESSING EACH MAP
  66.  
  67.   DO
  68.      INPUT #1, A$: IF A$ = "*END*" THEN EXIT DO
  69.      MAPname$ = PATH$ + A$ + ".map"
  70.      OPEN MAPname$ FOR INPUT AS #3
  71.  
  72.      INPUT #3, LATa: LINE INPUT #3, A$
  73.      INPUT #3, LONa: LINE INPUT #3, A$
  74.      INPUT #3, ppdV: LINE INPUT #3, A$
  75.      INPUT #3, LATx: LINE INPUT #3, A$
  76.      INPUT #3, LONx: LINE INPUT #3, A$
  77.      INPUT #3, RngX: LINE INPUT #3, A$
  78.      INPUT #3, x: LINE INPUT #3, A$
  79.      LINE INPUT #3, A$: REM ignore line of instructions
  80.     
  81.      i = 0
  82.      REM now make offset and scale calculations
  83.      Sfac = PPDD / ppdV
  84.      LOfset = LONa - NLon
  85.      LAfset = LATa - NLat
  86.  
  87.      PRINT "Doing "; MAPname$; "... ";
  88.      GUD = -1
  89.      DO WHILE NOT EOF(3)
  90.         i = i + 1: INPUT #3, x%, y%
  91.         IF x% <> 0 THEN
  92.            x% = Sfac * (x% - ppdV * LOfset)
  93.            y% = Sfac * (y% - ppdV * LAfset)
  94.            IF x% = 0 THEN x% = 1: PRINT "ZERO value of X!  Converted to 1,"; y%
  95.            END IF
  96.         REM print #4, MID$(STR$(x%), 2); ","; MID$(STR$(y%), 2)
  97.         IF GUD AND y% <> -1 THEN WRITE #4, x%, y%
  98.         IF x% = 0 AND NOT EOF(3) THEN ' Get line color & store with x=0
  99.            INPUT #3, z%: LINE INPUT #3, A$ ' Echo line name
  100. REM In the following line, choose the LINE colors to accept
  101.            IF z% <> 10 AND z% <> 6 THEN GUD = 0 ELSE GUD = -1
  102.            IF y% = -1 THEN EXIT DO' All labels listed at end of file
  103.            IF GUD THEN PRINT #4, z%; ","; A$
  104.         END IF
  105.         
  106.      LOOP
  107.      PRINT "Now doing labels... ";
  108.      DO WHILE NOT EOF(3)
  109.         INPUT #3, Lbl$, A, O, R
  110.         IF R > MapRng / 8 THEN
  111.            NL = NL + 1
  112.            Labels$(NL) = Lbl$ + "," + STR$(A) + "," + STR$(O) + "," + STR$(R)
  113.         END IF
  114.      LOOP: CLOSE #3: PRINT "Done!"
  115.   LOOP
  116.   PRINT #4, " 0,-1"
  117.   FOR i = 1 TO NL: PRINT #4, Labels$(i): NEXT i
  118.   CLOSE #4
  119.   CLOSE #1
  120.        
  121.   PRINT : PRINT "CONVERSION SUCCESSFUL TO YOUR NEW MAP FILE NAMED "; FO$
  122.   INPUT "Hit return to continue.."; A$: STOP
  123.  
  124. Errorfix: IF ERR = 62 THEN CLOSE #3: RESUME NEXT
  125.           IF ERR = 52 THEN RESUME NEXT
  126.           PRINT "ERROR NOT TRAPPED!"
  127.  
  128. END
  129.  
  130.